#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QStackedWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QFormLayout>
#include <QLabel>
#include <QMessageBox>
#include <QFrame>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget() override;  // 明确声明override

private slots:
    void switchToRegister();
    void switchToLogin();
    void attemptLogin();
    void attemptRegister();

private:
    Ui::Widget *ui;
    QStackedWidget *stackedWidget;

    // 登录页面控件
    QWidget *loginPage;
    QLineEdit *loginUsername;
    QLineEdit *loginPassword;
    QPushButton *loginButton;
    QPushButton *toRegisterButton;

    // 注册页面控件
    QWidget *registerPage;
    QLineEdit *registerUsername;
    QLineEdit *registerPassword;
    QLineEdit *confirmPassword;
    QPushButton *registerButton;
    QPushButton *toLoginButton;
};
#endif // WIDGET_H
